package Course10;

import java.text.DecimalFormat;

public class ShuZu {
    public static void main(String[] args) {
        double[] list = {1, 2, 3, 4, 5};
        int size = 5;
        double[] myList = new double[size];
        myList[0] = 5.6;
        myList[1] = 4.5;
        myList[2] = 3.3;
        myList[3] = 13.2;
        myList[4] = 4.67;

        double total = 0;
        for (int i = 0; i < size; i++) {
            total += myList[i];
        }

        System.out.println("总和为:" + total);
        DecimalFormat d = new DecimalFormat("#.00");
        System.out.println("总和为:" + d.format(total));

        for (int i = 0; i < myList.length; i++) {
            System.out.println(myList[i] + " ");

        }
        for (double e : myList) {
            System.out.println(e);
        }

        double[][] mylist1 = new double[2][];
        mylist1[0] = new double[2];
        mylist1[1] = new double[3];
        mylist1[0][0] = 1;
        mylist1[0][1] = 2;

        double[] max = new double[5];
        max[0] = 1.2;
        max[1] = 2.1;
        max[2] = 3.4;
        max[3] = 5.2;
        max[4] = 6.3;
        double x=max[0];
        for(int i=0;i<5;i++){
            if(max[i]>x){
                x=max[i];
            }
        }
        System.out.println(x);

    }
}